package com.slz3.business.module.drawManagement.draFreeLottery.service;

import com.slz3.business.frame.module.Repositorys;
import com.slz3.business.module.drawManagement.draFreeLottery.domain.DraFreeLottery;
import com.slz3.business.module.drawManagement.draFreeLottery.domain.DraFreeLotteryFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Slf4j
@Service
public class DraFreeLotteryTransactionalServiceImpl implements DraFreeLotteryTransactionalService {

    @Override
    public DraFreeLottery modify(DraFreeLottery draFreeLotteryNew) {
        Repositorys.draFreeLottery.test();
        Repositorys.draFreeLottery.save(DraFreeLotteryFactory.initBaseFields());
        System.err.println(1/0);
        draFreeLotteryNew.setLastModifyTime(LocalDateTime.now());
        return Repositorys.draFreeLottery.saveAndFlush(draFreeLotteryNew);
    }

    @Override
    public List<DraFreeLottery> batchModify(List<DraFreeLottery> draFreeLotteryList) {
        return Repositorys.draFreeLottery.saveAll(draFreeLotteryList);
    }
}
